// +FHDR------------------------------------------------------------
//                 Copyright (c) 2022 .
//                       ALL RIGHTS RESERVED
// -----------------------------------------------------------------
// Filename      : random_case.sv
// Author        : 
// Created On    : 2022-08-25 18:05
// Last Modified : 
// -----------------------------------------------------------------
// Description:
//
//
// -FHDR------------------------------------------------------------

`ifndef __RANDOM_CASE_SV__
`define __RANDOM_CASE_SV__

class random_case_spt extends spt_transaction;
    `uvm_object_utils(random_case_spt)
    function  new(string name= "random_case_spt");
        super.new(name);
    endfunction 
endclass

class random_case_seq extends spt_sequence;

	extern function new(string name = "random_case_seq");
	extern virtual task body();

	`uvm_object_utils(random_case_seq)
endclass: random_case_seq

function random_case_seq::new(string name = "random_case_seq");
	super.new(name);
endfunction: new

task random_case_seq::body();
	repeat(1000) begin
        `uvm_do(spt_tr)
	end
	#100;
endtask: body

class random_case extends base_test;

	extern function new(string name = "random_case", uvm_component parent=null);
	extern virtual function void build_phase(uvm_phase phase);
	
	`uvm_component_utils(random_case)
endclass: random_case

function random_case::new(string name = "random_case", uvm_component parent=null);
    super.new(name, parent);
endfunction: new

function void random_case::build_phase(uvm_phase phase);
	super.build_phase(phase);
    set_type_override_by_type(spt_transaction::get_type(), random_case_spt::get_type());
	uvm_config_db #(uvm_object_wrapper)::set(
		this,
		"env.tx_agt.sqr.main_phase",
		"default_sequence",
		random_case_seq::type_id::get()
	);
endfunction: build_phase

`endif
